package com.autumn.zero.workflow.configure;

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.autumn.zero.workflow.application.services.IWorkflowDefinitionAppService;
import com.autumn.zero.workflow.application.services.IWorkflowUserTaskAppService;
import com.autumn.zero.workflow.application.services.impl.WorkflowDefinitionAppServiceImpl;
import com.autumn.zero.workflow.application.services.impl.WorkflowUserTaskAppServiceImpl;
import com.autumn.zero.workflow.services.IProcessService;
import com.autumn.zero.workflow.services.IWorkflowDefinitionService;
import com.autumn.zero.workflow.services.impl.DefaultProcessServiceImpl;
import com.autumn.zero.workflow.services.impl.WorkflowDefinitionServiceImpl;

/**
 * 默认配置
 * 
 * @author 老码农 2018-12-19 23:49:16
 */
@Configuration
public class AutumnDefaultZeroWorkflowConfiguration {

	/**
	 * 工作流定义领域服务
	 * 
	 * @return
	 */
	@Bean
	@ConditionalOnMissingBean(IWorkflowDefinitionService.class)
	public IWorkflowDefinitionService autumnZeroWorkflowDefinitionService() {
		return new WorkflowDefinitionServiceImpl();
	}

	/**
	 * 工作流定义应用服务
	 * 
	 * @return
	 */
	@Bean
	@ConditionalOnMissingBean(IWorkflowDefinitionAppService.class)
	public IWorkflowDefinitionAppService autumnZeroWorkflowDefinitionAppService() {
		return new WorkflowDefinitionAppServiceImpl();
	}

	/**
	 * 默认的流程服务
	 * 
	 * @return
	 */
	@Bean
	@ConditionalOnMissingBean(IProcessService.class)
	public IProcessService autumnZeroProcessService() {
		return new DefaultProcessServiceImpl();
	}

	/**
	 * 用户工作流程任务应用服务
	 * 
	 * @return
	 */
	@Bean
	@ConditionalOnMissingBean(IWorkflowUserTaskAppService.class)
	public IWorkflowUserTaskAppService autumnZeroWorkflowUserTaskAppService() {
		return new WorkflowUserTaskAppServiceImpl();
	}
}
